<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Laporan Pembayaran Bulanan</title>
<?php $this->load->helper('HTML');
echo link_tag('css/style2.css');
echo link_tag('images/favicon.ico','shortcut icon','image/x-icon');
?></head>

</head>
<?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=keuangan_bulanan.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<body>
<table width="754" align="center" >
	<tr class="detail2">
   	  <td align="center">
        <table width="754" align="center">
        <tr class="detail2">
          <td width="440" valign="top"><img src="<?php echo base_url();?>images/logo.jpg" />&nbsp;</td>
          <td align="right">&nbsp;</td>
     	  </tr>
    </table>         
    <table width="754" align="center" border="0">
        
         <tr align="center" class="judul">
           <td>&nbsp;</td>
         </tr>
         <tr align="center" class="judul">
           <td>&nbsp;</td>
         </tr>
         <tr align="center" class="judul">
           <td>&nbsp;</td>
         </tr>
         <tr align="center" class="judul">
            <td>LAPORAN PEMBAYARAN <?php echo $cabang;?></td>
          </tr>
         
          <tr align="center" class="detail">
            <td>
            WEEK <?php echo $week_start[0]->intid_week;?>-<?php echo $week_end[0]->intid_week;?> ( <?php echo date('d M Y', strtotime($week_start[0]->dateweek_start))?> - <?php echo date('d M Y', strtotime($week_end[0]->dateweek_end))?>)</td>
          </tr>
    </table>   </td>
    <tr class="detail2">
    	<td align="center">
        	<table width="754" border="0" align="center"  class="detail">
			 <?php
               	 $treguler = 0;
				 $thut = 0;
				 $tchallenge = 0;
				 $tfreehut = 0;
				 $tfree = 0;
				 $ttrade = 0;
				 $tnetto = 0;
				 $tarisan = 0;
				 $tstlhkomisi = 0;
				 $tlain = 0;
				 $omsettulipreg=0;
				 $omsetmetalreg=0;
				 $omsettcreg=0;
				 foreach ($reguler as $row):
					     $omsettulipreg= $omsettulipreg + $row->omsettulip;
						 $omsetmetalreg= $omsetmetalreg + $row->omsetmetal;
						 $omsettcreg= $omsettcreg + $row->omsettc;
					endforeach;	 
			?>
            <tr class="detail">
              <td width="372" class="detail2">&nbsp;PENJUALAN REGULER :
              <hr /></td>
              <td width="183">&nbsp;</td>
              <td width="164">&nbsp;</td>
              </tr>
              <tr class="data">
                    <td>&nbsp;TULIP</td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($omsettulipreg,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
                <tr >
                	<td>&nbsp;METAL</td>
                    <td>&nbsp;<?php echo "Rp. ".number_format($omsetmetalreg,2 , ',' , '.');?> </td>
                   	<td>&nbsp;</td>
                </tr>
                <tr>
                  <td> &nbsp;TULIP CARE</td>
                  <td>&nbsp;<?php echo "Rp. ".number_format($omsettcreg,2 , ',' , '.');?><hr /></td>
                  <td>&nbsp;</td>
                </tr>
                <tr class="detail">
                	<td class="detail2" align="right">TOTAL PENJUALAN REGULER</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $treguler = $treguler + $omsettulipreg + $omsetmetalreg + $omsettcreg; echo "Rp. ".number_format($treguler,2 , ',' , '.');?> </td>
                </tr>
               <?php 
 				 $omsettuliphut=0;
				 $omsetmetalhut=0;
				 $omsettchut=0;
				 foreach ($hut as $row1):
					     $omsettuliphut= $omsettuliphut + $row1->omsettulip;
						 $omsetmetalhut= $omsetmetalhut + $row1->omsetmetal;
						 $omsettchut= $omsettchut + $row1->omsettc;
				 endforeach;
			   ?>
              <tr class="detail">
              <td width="372" class="detail2">&nbsp;PENJUALAN HUT :
                <hr /></td>
              <td width="183">&nbsp;</td>
              <td width="164">&nbsp;</td>
              </tr>
               <tr class="data">
                    <td>&nbsp;TULIP</td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($omsettuliphut,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
                <tr>
                	<td>&nbsp;METAL</td>
                    <td>&nbsp;<?php echo "Rp. ".number_format($omsetmetalhut,2 , ',' , '.');?> </td>
                   	<td>&nbsp;</td>
                </tr>
                <tr>
                  <td> &nbsp;TULIP CARE</td>
                  <td>&nbsp;<?php echo "Rp. ".number_format($omsettchut,2 , ',' , '.');?><hr /></td>
                  <td>&nbsp;</td>
                </tr>
                <tr class="detail">
                	<td class="detail2" align="right">TOTAL PENJUALAN HUT</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $thut = $thut + $omsettuliphut + $omsetmetalhut + $omsettchut ; echo "Rp. ".number_format($thut,2 , ',' , '.');?> </td>
                </tr>
             <?php 
			   	 $omsettulipchallenge=0;
				 $omsetmetalchallenge=0;
				 $omsettcchallenge=0;
				 foreach ($challenge as $row2):
					     $omsettulipchallenge= $omsettulipchallenge + $row2->omsettulip;
						 $omsetmetalchallenge= $omsetmetalchallenge + $row2->omsetmetal;
						 $omsettcchallenge= $omsettcchallenge + $row2->omsettc;
				 endforeach;
			?>
              <tr class="detail">
              <td width="372" class="detail2">&nbsp;PENJUALAN CHALLENGE :
                <hr /></td>
              <td width="183">&nbsp;</td>
              <td width="164">&nbsp;</td>
              </tr>
               <tr class="data">
                    <td>&nbsp;TULIP</td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($omsettulipchallenge,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
                <tr>
                	<td>&nbsp;METAL</td>
                    <td>&nbsp;<?php echo "Rp. ".number_format($omsetmetalchallenge,2 , ',' , '.');?> </td>
                   	<td>&nbsp;</td>
                </tr>
                <tr>
                  <td> &nbsp;TULIP CARE</td>
                  <td>&nbsp;<?php echo "Rp. ".number_format($omsettcchallenge,2 , ',' , '.');?><hr /></td>
                  <td>&nbsp;</td>
                </tr>
                <tr class="detail">
                	<td class="detail2" align="right">TOTAL PENJUALAN CHALLENGE</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $tchallenge = $tchallenge + $omsettulipchallenge + $omsetmetalchallenge + $omsettcchallenge ; echo "Rp. ".number_format($tchallenge,2 , ',' , '.');?> </td>
                </tr>
                <?php 
			   	 $omsettulipfree=0;
				 $omsetmetalfree=0;
				 $omsettcfree=0;
				 foreach ($free as $row3):
					     $omsettulipfree= $omsettulipfree + $row3->omsettulip;
						 $omsetmetalfree= $omsetmetalfree + $row3->omsetmetal;
						 $omsettcfree= $omsettcfree + $row3->omsettc;
				 endforeach;
			?>
              <tr class="detail">
              <td width="372" class="detail2">&nbsp;PENJUALAN 1 FREE 1 :
                <hr /></td>
              <td width="183">&nbsp;</td>
              <td width="164">&nbsp;</td>
              </tr>
               <tr class="data">
                    <td>&nbsp;TULIP</td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($omsettulipfree,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
                <tr>
                	<td>&nbsp;METAL</td>
                    <td>&nbsp;<?php echo "Rp. ".number_format($omsetmetalfree,2 , ',' , '.');?> </td>
                   	<td>&nbsp;</td>
                </tr>
                <tr>
                  <td> &nbsp;TULIP CARE</td>
                  <td>&nbsp;<?php echo "Rp. ".number_format($omsettcfree,2 , ',' , '.');?><hr /></td>
                  <td>&nbsp;</td>
                </tr>
                <tr class="detail">
                	<td class="detail2" align="right">TOTAL PENJUALAN 1 FREE 1</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $tfree = $tfree + $omsettulipfree + $omsetmetalfree + $omsettcfree ; echo "Rp. ".number_format($tfree,2 , ',' , '.');?> </td>
                </tr>
                <?php 
			   	 $omsettulipfreehut=0;
				 $omsetmetalfreehut=0;
				 $omsettcfreehut=0;
				 foreach ($freehut as $row4):
					     $omsettulipfreehut= $omsettulipfreehut + $row4->omsettulip;
						 $omsetmetalfreehut= $omsetmetalfreehut + $row4->omsetmetal;
						 $omsettcfreehut= $omsettcfreehut + $row4->omsettc;
				 endforeach;
			?>
              <tr class="detail">
              <td width="372" class="detail2">&nbsp;PENJUALAN 1 FREE 1 HUT:
                <hr /></td>
              <td width="183">&nbsp;</td>
              <td width="164">&nbsp;</td>
              </tr>
               <tr class="data">
                    <td>&nbsp;TULIP</td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($omsettulipfreehut,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
                <tr>
                	<td>&nbsp;METAL</td>
                    <td>&nbsp;<?php echo "Rp. ".number_format($omsetmetalfreehut,2 , ',' , '.');?> </td>
                   	<td>&nbsp;</td>
                </tr>
                <tr>
                  <td> &nbsp;TULIP CARE</td>
                  <td>&nbsp;<?php echo "Rp. ".number_format($omsettcfreehut,2 , ',' , '.');?><hr /></td>
                  <td>&nbsp;</td>
                </tr>
                <tr class="detail">
                	<td class="detail2" align="right">TOTAL PENJUALAN 1 FREE 1 HUT</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $tfreehut = $tfreehut + $omsettulipfreehut + $omsetmetalfreehut + $omsettcfreehut ; echo "Rp. ".number_format($tfreehut,2 , ',' , '.');?> </td>
                </tr>
                <?php 
			   	 $omsettulipnetto=0;
				 $omsetmetalnetto=0;
				 $omsettcnetto=0;
				 foreach ($netto as $row5):
					     $omsettulipnetto= $omsettulipnetto + $row5->omsettulip;
						 $omsetmetalnetto= $omsetmetalnetto + $row5->omsetmetal;
						 $omsettcnetto= $omsettcnetto + $row5->omsettc;
				 endforeach;
			?>
              <tr class="detail">
              <td width="372" class="detail2">&nbsp;PENJUALAN NETTO:
                <hr /></td>
              <td width="183">&nbsp;</td>
              <td width="164">&nbsp;</td>
              </tr>
               <tr>
                    <td class="data">&nbsp;TULIP</td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($omsettulipnetto,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
                <tr>
                	<td>&nbsp;METAL</td>
                    <td>&nbsp;<?php echo "Rp. ".number_format($omsetmetalnetto,2 , ',' , '.');?> </td>
                   	<td>&nbsp;</td>
                </tr>
                <tr>
                  <td> &nbsp;TULIP CARE</td>
                  <td>&nbsp;<?php echo "Rp. ".number_format($omsettcnetto,2 , ',' , '.');?><hr /></td>
                  <td>&nbsp;</td>
                </tr>
                <tr class="detail">
                	<td class="detail2" align="right">TOTAL PENJUALAN NETTO</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $tnetto = $tnetto + $omsettulipnetto + $omsetmetalnetto + $omsettcnetto ; echo "Rp. ".number_format($tnetto,2 , ',' , '.');?> </td>
                </tr>
                <?php 
			   	 $omsettrade30=0;
				 $omsettrade40=0;
				 $omsettrade50=0;
				 foreach ($trade as $row6):
					     $omsettrade30= $omsettrade30 + $row6->omsett30;
						$omsettrade40= $omsettrade40 + $row6->omsett40;
						 $omsettrade50= $omsettrade50 + $row6->omsett50;
				 endforeach;
			?>
              <tr class="detail">
              <td width="372" class="detail2">&nbsp;PENJUALAN TRADE IN:
                <hr /></td>
              <td width="183">&nbsp;</td>
              <td width="164">&nbsp;</td>
              </tr>
               <tr class="data">
                    <td>&nbsp;T30</td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($omsettrade30,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
		<tr class="data">
                    <td>&nbsp;T40</td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($omsettrade40,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
                <tr>
                	<td>&nbsp;T50</td>
                    <td>&nbsp;<?php echo "Rp. ".number_format($omsettrade50,2 , ',' , '.');?> </td>
                   	<td>&nbsp;</td>
                </tr>
                <tr>
                	<td class="detail2" align="right">TOTAL PENJUALAN TRADE IN</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $ttrade = $ttrade + $omsettrade30 + $omsettrade40 + $omsettrade50; echo "Rp. ".number_format($ttrade,2 , ',' , '.');?> </td>
                </tr>
                <tr class="detail">
                	<td class="detail2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GRAND TOTAL OMSET</td><td>&nbsp;</td>
                    <td>&nbsp;<?php
				   
				 $tsementara = $treguler + $thut + $tchallenge + $tfreehut + $tfree + $ttrade + $tarisan + $tnetto; echo "Rp. ".number_format($tsementara,2 , ',' , '.');?></td>
              </tr>
                <tr>
                	<td>&nbsp;</td>
                    <td>KOMISI 10%</td>
                   	<td>&nbsp;<?php echo "Rp. ".number_format($komisi[0]->komisi10,2 , ',' , '.');?> </td>
                </tr>
                <tr>
                	<td>&nbsp;</td>
                    <td>KOMISI 20%</td>
                   	<td>&nbsp;<?php echo "Rp. ".number_format($komisi[0]->komisi20,2 , ',' , '.');?></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
               	  <td>&nbsp;<?php $tstlhkomisi = $tstlhkomisi + $tsementara - $komisi[0]->komisi10 - $komisi[0]->komisi20; echo "Rp. ".number_format($tstlhkomisi,2 , ',' , '.');?></td>
                </tr>
               <?php
				 $omsetlevelgift=0;
				 $omsetlain=0;
				 foreach ($jlain as $row8):
				 	$omsetlevelgift = $omsetlevelgift + $row8->omsetlg;
					$omsetlain = $omsetlain + $row8->omsetll;
				 endforeach;
			 ?>
              <tr class="detail">
              <td width="372" class="detail2">&nbsp;PENJUALAN LAIN-LAIN:
                <hr /></td>
              <td width="183">&nbsp;</td>
              <td width="164">&nbsp;</td>
              </tr>
               
                <tr class="data">
                    <td>&nbsp;STARTER KIT</td>
                    <td align="left"><?php echo "Rp. ".number_format($sk[0]->total,2 , ',' , '.');?></td>
                    <td align="left">&nbsp;</td>
              </tr>
                <tr>
                	<td>&nbsp;LEVEL GIFT</td>
                    <td><?php echo "Rp. ".number_format($omsetlevelgift,2 , ',' , '.');?> </td>
                   	<td>&nbsp;</td>
                </tr>
                <tr>
                  <td> &nbsp;KATALOG + FLAYER + VOUCHER</td>
                  <td><?php echo "Rp. ".number_format($omsetlain,2 , ',' , '.');?></td>
                 <td>&nbsp;</td>
                </tr>
                <?php 
				 $omsetspecial=0;
				 foreach ($spesial as $row9):
					     $omsetspecial= $omsetspecial + $row9->inttotal_bayar;
				endforeach;
				?>
                <tr>
                  <td> &nbsp;PENJUALAN SPECIAL PRICE</td>
                  <td><?php echo "Rp. ".number_format($omsetspecial,2 , ',' , '.');?></td>
                 <td>&nbsp;</td>
                </tr>
		<?php 
				 $omsetpoint=0;
				 foreach ($point as $row95):
					     $omsetpoint= $omsetpoint + $row95->inttotal_bayar;
				endforeach;
				?>
                <tr>
                  <td> &nbsp;PENJUALAN SPECIAL PRICE (POINT)</td>
                  <td><?php echo "Rp. ".number_format($omsetpoint,2 , ',' , '.');?></td>
                 <td>&nbsp;</td>
                </tr>
		<?php 
				 $omsetmetal50=0;
				 foreach ($metal50 as $row975):
					     $omsetmetal50= $omsetmetal50 + $row975->inttotal_bayar;
				endforeach;
				?>
                <tr>
                  <td> &nbsp;PENJUALAN METAL 50%</td>
                  <td><?php echo "Rp. ".number_format($omsetmetal50,2 , ',' , '.');?></td>
                 <td>&nbsp;</td>
                </tr>
                <?php 
			   	 $omsetarisan=0;
				 foreach ($arisan as $row10):
					     $omsetarisan= $omsetarisan + $row10->inttotal_bayar;
				 endforeach;
				?>
                <tr>
                  <td> &nbsp;ARISAN</td>
                  <td><?php echo "Rp. ".number_format($omsetarisan,2 , ',' , '.');?>
                  <hr /></td>
                 <td>&nbsp;</td>
                </tr>
                <tr>
                	<td>&nbsp;</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $tlain = $tlain +  $sk[0]->total + $omsetlevelgift+ $omsetlain + $omsetspecial + $omsetarisan + $omsetpoint + $omsetmetal50; echo "Rp. ".number_format($tlain,2 , ',' , '.');?> <hr /></td>
                </tr>
                <tr class="detail">
                	<td class="detail2" align="right">&nbsp;TOTAL PEMBAYARAN</td>
                  <td>&nbsp;</td>
                   	<td>&nbsp;<?php $tall = $tstlhkomisi +  $tlain; echo "Rp. ".number_format($tall,2 , ',' , '.');?> </td>
                </tr>
                <tr>
                	<td align="right">&nbsp;PIUTANG SEBELUMNYA</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php  $piutang = $total_bayar[0]->total_bayar - $sudah_bayar[0]->sudah_bayar; echo "Rp. ".number_format($piutang,2 , ',' , '.');?></td>
                </tr>
                <tr>
                  <td class="detail2" align="right">&nbsp;DP</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;<?php echo "Rp. ".number_format($dp[0]->intcash,2 , ',' , '.');?></td>
                </tr>
                <tr class="detail">
                	<td class="detail2" align="right">&nbsp;GRAND TOTAL PEMBAYARAN</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $gtotal = $tall +  $piutang + $dp[0]->intcash; echo "Rp. ".number_format($gtotal,2 , ',' , '.');?> </td>
                </tr>
                <tr>
                	<td>&nbsp;</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp; </td>
                </tr>
                <tr class="detail">
                	<td>&nbsp;PEMBAYARAN</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp; </td>
                </tr>
                <tr >
                	<td colspan="3">
                    <table width="100%" border="1" class="detail" align="center">
			<tr class="detail2">
                	<th width="18%"><strong>TANGGAL</strong></th>
                <th width="25%">NAMA BANK</th>
                    <th width="34%">KETERANGAN</th>
                <th width="23%">&nbsp;</th>
                </tr>
                <?php
				 $tbayar = 0;
                 foreach($pembayaran as  $d):
                ?>
                <tr>
                    <td align="center"><?php echo $d->datetanggal?></td>
                    <td align="center"><?php echo $d->nama_bank?></td>
                    <td align="center"><?php echo $d->keterangan?></td>
                    <td align="left">&nbsp;<?php echo "Rp. ".number_format($d->nominal_bayar,2 , ',' , '.');?></td>
                </tr>
                <?php 
				$tbayar = $tbayar + $d->nominal_bayar;
				endforeach;?>
             </table></td>
                </tr>
                <tr class="detail">
                	<td class="detail2">SALDO YANG MASIH HARUS DIBAYAR</td>
                    <td>&nbsp;</td>
                   	<td>&nbsp;<?php $tsaldo = $gtotal -  $tbayar; echo "Rp. ".number_format($tsaldo,2 , ',' , '.');?> </td>
                </tr>
      </table>      
      
      </td>
    </tr>
</table>
</body>
</html>